cmake_minimum_required(VERSION 3.10.2)
project(timewheel)
find_package(Threads)
set(CMAKE_CXX_STANDARD 17) 
add_definitions("-Wall -g")

file(GLOB_RECURSE utils_srcs  ../server/base/src/*.cpp)
file(GLOB_RECURSE datatime_srcs ../server/datetime/src/*.cpp)
file(GLOB_RECURSE logger_srcs ../server/logging/src/*.cpp)
file(GLOB_RECURSE thread_srcs  ../server/thread/src/*.cpp)
file(GLOB_RECURSE http_srcs  ./http/src/*.cpp)
file(GLOB_RECURSE net_srcs  ../server/net/src/*.cpp)

# add_executable(http test.cpp ${logger_srcs} ${utils_srcs} ${thread_srcs} ${net_srcs} ${datatime_srcs} ${http_srcs})
# target_link_libraries(http ${CMAKE_THREAD_LIBS_INIT} lua)

add_executable(main main.cpp ./tcprelay/webRelay.cpp ./tcprelay/tunnel.cpp ${logger_srcs} ${utils_srcs} ${thread_srcs} ${net_srcs} ${datatime_srcs} ${http_srcs})
target_link_libraries(main ${CMAKE_THREAD_LIBS_INIT} lua)

add_executable(server server.cpp ./fastcgi/fastcgi.cpp ./tcprelay/webRelay.cpp ./tcprelay/tunnel.cpp ./fastcgi/sudoku/soduku.cpp ${logger_srcs} ${utils_srcs} ${thread_srcs} ${net_srcs} ${datatime_srcs} ${http_srcs})
target_link_libraries(server ${CMAKE_THREAD_LIBS_INIT} lua)

add_executable(fastcgi server_fastcgi.cpp ./fastcgi/fastcgi.cpp ./tcprelay/webRelay.cpp ./tcprelay/tunnel.cpp ./fastcgi/sudoku/soduku.cpp ${logger_srcs} ${utils_srcs} ${thread_srcs} ${net_srcs} ${datatime_srcs} ${http_srcs})
target_link_libraries(fastcgi ${CMAKE_THREAD_LIBS_INIT} lua)

# add_executable(luat lua_test.cpp)
# target_link_libraries(luat lua)